/*
 * ethernet.h
 *
 *  Created on: Oct 24, 2013
 *      Author: Ken Arok
 */

#ifndef ETHERNET_H_
#define ETHERNET_H_

#include "config_peripherals.h"

#if ETHERNET_PERIPHERAL_ACTIVE

/* Scheduler include files. */
#include "FreeRTOS.h"


#define NETLINK_CONNECT_ICON		0xEF
#define NETLINK_DISCONNECT_ICON		0xF8

#define ETH_RESTART_MODULE			1
#define ETH_SET_DEFAULT				2
#define ETH_LOAD_SETTING_FROM_ROM	3
#define ETH_SAVE_SETTING_TO_ROM		4
#define ETH_SET_IP_ADDR				5
#define ETH_SET_SUBNET_MASK			6
#define ETH_SET_GATEWAY				7
#define ETH_SET_MODE				8

typedef uint8_t eth_request_code_t;

/** \brief Initialize Ethernet layer.
 */
extern void vEthernetInit(void);

/** \brief Read IP Address String.
 *
 * @return Pointer of IP Address string.
 */
extern void *vEthernet_ReadIPAddress(void);

/** \brief Read MAC Address String.
 *
 * @return Pointer of MAC Address string.
 */
extern void *vEthernet_ReadMACAddress(void);

/** \brief Read Network Link Status.
 *
 * @return 0 = Disconnect; 1 = Connecting; 2 = Connected.
 */
extern uint8_t vEthernet_ReadNetworkStatus(void);

/** \brief Ethernet Control.
 *
 * \param reqCode		Request Code.
 * \param pValue		Pointer to the value.
 *
 * \return	status		pdPASS = Success, pdFAIL = failed.
 *
 */
extern portBASE_TYPE vEthernetCtrl(eth_request_code_t reqCode, void *pValue);

#else /* ETHERNET_PERIPHERAL_ACTIVE */
#define vEthernetInit()
#define vEthernetCtrl(a, b, c)	pdFAIL

#endif /* ETHERNET_PERIPHERAL_ACTIVE */

#endif /* ETHERNET_H_ */
